<h1>Spinetail</h1>
<p>A rapid-web-application-prototyping framework in JavaScript</p>
<h2>Documentation</h2>
<h3>About</h3>
<p>Please read the <a href="README.txt">README</a></p>
<p>Spinetail is a lightweight JavaScript framework designed to help developers quickly and easily create working prototypes of web applications. Unlike other JavaScript frameworks Spinetail is not designed to be secure, robust or comprehensive. Instead Spinetail has no external dependencies, is small, fast, easy to learn, easy to use and easy to setup. With Spinetail you don't need to spend time configuring a server or otherwise setting up a development environment. Spinetail requires no server configuration or setup of any kind and can run in any browser that supports JavaScript and AJAX (active internet connection not required). Simply download spinetail to a web-accessible local directory, or upload it to a public-facing web server then get started prototyping your application using an MVC architectural pattern, JavaScript and HTML.</p>
<h3>When to Use Spinetail</h3>
<p>Use spinetail when you want to prototype a web-application before you start on the production or development builds, and possibly before you even decide on what technologies the web application will use. You may have some static wireframes to work off of or a written specification, but in either case you need to see the program in action at an early stage.</p>
<h3>Strengths and Weaknesses</h3>
<p>Strengths</p>
<blockquote>
<p>Spinetail Framework</p>
<ul>
<li>Written entirely in JavaScript</li>
<li>72K uncompressed including all third-party code</li>
<li>Global abatement to prevent clashing</li>
<li>Exception handling</li>
<li>No server setup</li>
<li>Extremely simple templating</li>
<li>URL parameters automatically mapped to global object</li>
</ul>
<p>Spinetail Applications</p>
<ul>
<li>MVC architectural pattern</li>
<li>Simple CRUD Interface (Create, Read, Update, Delete)</li>
<li>Views are plain HTML</li>
<li>Controllers are JavaScript</li>
<li>Applications can be distributed easily (e.g. zip your app and e-mail it)</li>
</ul>
</blockquote>
<p>Weaknesses</p>
<blockquote>
<p>Spinetail Framework</p>
<ul>
<li>No POST support</li>
</ul>
<p>Spinetail Applications</p>
<ul>
	<li>Model data is not persistant</li>
</ul>
</blockquote>
<h3>Setup</h3>
<p>Basic setup consists of three simple steps:</p>
<ol>
	<li>Unarchive spinetail into a web-accessible directory (e.g. ~/Sites on Mac OS X)</li>
	<li>Open index.xml in an editor of your choice and set the base href tag to point to your root spinetail directory</li>
	<li>Open index.xml in a web browser</li>
</ol>
<p>If you want to use a model there are two additional steps:</p>
<ol>
	<li>Familiarize yourself with <a href="http://www.taffydb.com">Taffy DB</a></li>
	<li>Create collections in /_model/collections.js</li>
</ol>
<h3>Getting Started</h3>
<ol>
	<li>Create a new view file named "hello_world.html" and place it in the /_view directory.</li>
	<li>Edit hello_world.html to include only the following text: &#37;&#37;replaceMe&#37;&#37;</li>
	<li>Next create a new controller file named "hello_world.json" (views and controllers always have the same file name) and place it in the /_controllers directory.</li>
	<li>Edit the hello_world.json file to include the following code:<pre>
	{
		/* If you want to use comments in your controller they must be of multi-line type, not // */
		documentTitle: "Hello World!",
		main: function() {
			document.title = this.documentTitle;

			return spinetail.replaceInView(arguments[0], "foo", spinetail.currentParameters.replaceWith);
			}
	}</pre></li>
	<li>Ask spinetail to dispatch your new view, and deserialize your new controller by visiting http://yourdomain/path/to/spinetail/index.xml?view=hello_world&#38;replaceWith=Hello%20World!</li>
</ol>
<ul>
	<li>Your controller's methods and properties are now mapped to the spinetail.currentController object</li>
	<li>All of the parameters you passed in the URL string are now mapped to the spinetail.currentParameters object</li>
	<li>Properties and methods defined in globals.js are now mapped to the spinetail.globals object</li>
	<li>Your model is mapped to spinetail.model</li>
</ul>
<p>For basic functionality, that is all there is to it. If you want to work with a model, read the "Working with Model" section below.</p>

<p>Note: Controllers can of course contain any number of properties and methods, but only the main method is executed when a view is dispatched. If you want a specific method within your controller to be executed when you dispatch a view (AKA onLoad), make sure to call it from main.</p>
<h3>Working with Models</h3>
<p>Once you familiarize yourself with <a href="http://www.taffydb.com">Taffy DB</a>, working with models in spinetail is really very simple and intuitive. Data can be created, read, updated and deleted from "collections" by creating simple methods in your controllers. The important thing to remember though is that in spinetail, data is not persistent. Meaning any changes made to a collection's data revert during the next page load. The exception to this is data that is defined in the collections.js file, when a collection itself is defined.</p><p>If you need data to persist you can modify spinetail to write cookies or use some sort of server-side data store.</p>
<h3>What's a "Spinetail"</h3>
<p>It's a bird. Try a <a href="http://www.google.com/search?q=spinetail+bird+photos">google search</a> for "spinetail bird photos."</p>
